|
RAIS
3.2
|
00001 using System; 00002 using System.Collections.Generic; 00003 using System.Text; 00004 using System.ComponentModel; 00005 using RAIS.Common; 00006 using RAIS.DataAccessLayer; 00007 using RAIS.Common.MessageManagement; 00008 namespace RAIS.ApplicationLogicLayer 00009 { 00010 public class LogFileCollection: BindingList<HistoryRow> 00011 { 00012 #region Fields 00013 String tableName=null; 00014 List<HistoryRow> rows = new List<HistoryRow>(); 00015 #endregion 00016 #region Propeties 00017 00018 00019 00020 public String TableName 00021 { 00022 get { return tableName; } 00023 set { tableName = value; } 00024 } 00025 #endregion 00026 #region Public methods 00027 00028 00029 00030 00031 00032 public void SetDateRange(DateTime start, DateTime end) 00033 { 00034 Clear(); 00035 foreach (HistoryRow row in rows) 00036 { 00037 DateTime date = DateTime.Parse(row.Date); 00038 date = date.Date; 00039 if (date >= start && date <= end) 00040 Add(row); 00041 } 00042 } 00043 #endregion 00044 #region Constructors 00045 00046 00047 00048 00049 00050 public LogFileCollection(int tableID, int primaryKey) 00051 { 00052 LoggingSystem log = new LoggingSystem(); 00053 List<Dictionary<string, object>> list = log.LoadHistory(tableID, primaryKey); 00054 foreach (Dictionary<string, object> dic in list) 00055 { 00056 rows.Add(new HistoryRow((DateTime)dic["Date"], (string)dic["User"], 00057 (Message.ModificationType)dic["Operation"], 00058 (string)dic["Field Name"], (string)dic["Field Value"])); 00059 Add(new HistoryRow((DateTime)dic["Date"], (string)dic["User"], 00060 (Message.ModificationType)dic["Operation"], 00061 (string)dic["Field Name"], (string)dic["Field Value"])); 00062 } 00063 } 00064 #endregion 00065 } 00066 }